// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
//
//------------------------------------------------------------------------------
// This code was generated by google-apis-code-generator 1.5.1
//
//  Changes to this file may cause incorrect behavior and will be lost if
//  the code is regenerated.
//------------------------------------------------------------------------------
#include "google/storage_api/storage_service.h"

#include <string>
#include "googleapis/base/integral_types.h"
#include "googleapis/client/service/client_service.h"
#include "googleapis/client/service/media_uploader.h"
#include "googleapis/client/service/service_request_pager.h"
#include "googleapis/client/util/status.h"

#include "google/storage_api/bucket.h"
#include "google/storage_api/bucket_access_control.h"
#include "google/storage_api/bucket_access_controls.h"
#include "google/storage_api/buckets.h"
#include "google/storage_api/channel.h"
#include "google/storage_api/compose_request.h"
#include "google/storage_api/notification.h"
#include "google/storage_api/notifications.h"
#include "google/storage_api/object.h"
#include "google/storage_api/object_access_control.h"
#include "google/storage_api/object_access_controls.h"
#include "google/storage_api/objects.h"
#include "google/storage_api/policy.h"
#include "google/storage_api/rewrite_response.h"
#include "google/storage_api/service_account.h"
#include "google/storage_api/test_iam_permissions_response.h"


#include "googleapis/client/data/data_reader.h"
#include "googleapis/client/transport/http_request.h"
#include "googleapis/client/transport/http_transport.h"
#include "googleapis/client/util/uri_utils.h"
#include "googleapis/strings/strcat.h"

namespace google_storage_api {
using namespace googleapis;
const char StorageService::googleapis_API_NAME[] = { "storage" };

const char StorageService::googleapis_API_VERSION[] = { "v1" };

const char StorageService::googleapis_API_GENERATOR[] = {
  "google-apis-code-generator 1.5.1 / 0.1.5"};


const char StorageService::SCOPES::CLOUD_PLATFORM[] = {"https://www.googleapis.com/auth/cloud-platform"};

const char StorageService::SCOPES::CLOUD_PLATFORM_READ_ONLY[] = {"https://www.googleapis.com/auth/cloud-platform.read-only"};

const char StorageService::SCOPES::DEVSTORAGE_FULL_CONTROL[] = {"https://www.googleapis.com/auth/devstorage.full_control"};

const char StorageService::SCOPES::DEVSTORAGE_READ_ONLY[] = {"https://www.googleapis.com/auth/devstorage.read_only"};

const char StorageService::SCOPES::DEVSTORAGE_READ_WRITE[] = {"https://www.googleapis.com/auth/devstorage.read_write"};
StorageServiceBaseRequest::StorageServiceBaseRequest(
      const client::ClientService* service,
      client::AuthorizationCredential* credential,
      client::HttpRequest::HttpMethod method,
      const string& uri_template)
    : client::ClientServiceRequest(
          service, credential, method, uri_template),
      alt_("json"),
      pretty_print_(true),
      _have_alt_(false),
      _have_fields_(false),
      _have_key_(false),
      _have_oauth_token_(false),
      _have_pretty_print_(false),
      _have_quota_user_(false),
      _have_user_ip_(false) {
}

StorageServiceBaseRequest::~StorageServiceBaseRequest() {
}

util::Status StorageServiceBaseRequest::AppendVariable(
    const string& variable_name,
    const client::UriTemplateConfig& config,
    string* target) {
  return client::StatusInvalidArgument(
      StrCat("Unknown url variable='", variable_name, "'"));
}

util::Status StorageServiceBaseRequest::AppendOptionalQueryParameters(
    string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_alt_) {
    StrAppend(target, sep, "alt=",
              client::CppValueToEscapedUrlValue(
                alt_));
    sep = "&";
  }
  if (_have_fields_) {
    StrAppend(target, sep, "fields=",
              client::CppValueToEscapedUrlValue(
                fields_));
    sep = "&";
  }
  if (_have_key_) {
    StrAppend(target, sep, "key=",
              client::CppValueToEscapedUrlValue(
                key_));
    sep = "&";
  }
  if (_have_oauth_token_) {
    StrAppend(target, sep, "oauth_token=",
              client::CppValueToEscapedUrlValue(
                oauth_token_));
    sep = "&";
  }
  if (_have_pretty_print_) {
    StrAppend(target, sep, "prettyPrint=",
              client::CppValueToEscapedUrlValue(
                pretty_print_));
    sep = "&";
  }
  if (_have_quota_user_) {
    StrAppend(target, sep, "quotaUser=",
              client::CppValueToEscapedUrlValue(
                quota_user_));
    sep = "&";
  }
  if (_have_user_ip_) {
    StrAppend(target, sep, "userIp=",
              client::CppValueToEscapedUrlValue(
                user_ip_));
    sep = "&";
  }
  return client::ClientServiceRequest
         ::AppendOptionalQueryParameters(target);
}


void StorageServiceBaseRequest::AddJsonContentToRequest(
    const client::JsonCppData *content) {
  client::HttpRequest* _http_request_ = mutable_http_request();
  _http_request_->set_content_type(
        client::HttpRequest::ContentType_JSON);
  _http_request_->set_content_reader(content->MakeJsonReader());
}



// Standard constructor.
BucketAccessControlsResource_DeleteMethod::BucketAccessControlsResource_DeleteMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::DELETE,
        "b/{bucket}/acl/{entity}"),
      bucket_(bucket.as_string()),
      entity_(entity.as_string()),
      _have_user_project_(false) {
}

// Standard destructor.
BucketAccessControlsResource_DeleteMethod::~BucketAccessControlsResource_DeleteMethod() {
}

util::Status BucketAccessControlsResource_DeleteMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketAccessControlsResource_DeleteMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketAccessControlsResource_GetMethod::BucketAccessControlsResource_GetMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/acl/{entity}"),
      bucket_(bucket.as_string()),
      entity_(entity.as_string()),
      _have_user_project_(false) {
}

// Standard destructor.
BucketAccessControlsResource_GetMethod::~BucketAccessControlsResource_GetMethod() {
}

util::Status BucketAccessControlsResource_GetMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketAccessControlsResource_GetMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketAccessControlsResource_InsertMethod::BucketAccessControlsResource_InsertMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const BucketAccessControl& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "b/{bucket}/acl"),
      bucket_(bucket.as_string()),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
BucketAccessControlsResource_InsertMethod::~BucketAccessControlsResource_InsertMethod() {
}

util::Status BucketAccessControlsResource_InsertMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketAccessControlsResource_InsertMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketAccessControlsResource_ListMethod::BucketAccessControlsResource_ListMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/acl"),
      bucket_(bucket.as_string()),
      _have_user_project_(false) {
}

// Standard destructor.
BucketAccessControlsResource_ListMethod::~BucketAccessControlsResource_ListMethod() {
}

util::Status BucketAccessControlsResource_ListMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketAccessControlsResource_ListMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketAccessControlsResource_PatchMethod::BucketAccessControlsResource_PatchMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity, const BucketAccessControl& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PATCH,
        "b/{bucket}/acl/{entity}"),
      bucket_(bucket.as_string()),
      entity_(entity.as_string()),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
BucketAccessControlsResource_PatchMethod::~BucketAccessControlsResource_PatchMethod() {
}

util::Status BucketAccessControlsResource_PatchMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketAccessControlsResource_PatchMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketAccessControlsResource_UpdateMethod::BucketAccessControlsResource_UpdateMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity, const BucketAccessControl& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PUT,
        "b/{bucket}/acl/{entity}"),
      bucket_(bucket.as_string()),
      entity_(entity.as_string()),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
BucketAccessControlsResource_UpdateMethod::~BucketAccessControlsResource_UpdateMethod() {
}

util::Status BucketAccessControlsResource_UpdateMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketAccessControlsResource_UpdateMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketsResource_DeleteMethod::BucketsResource_DeleteMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::DELETE,
        "b/{bucket}"),
      bucket_(bucket.as_string()),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_user_project_(false) {
}

// Standard destructor.
BucketsResource_DeleteMethod::~BucketsResource_DeleteMethod() {
}

util::Status BucketsResource_DeleteMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketsResource_DeleteMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketsResource_GetMethod::BucketsResource_GetMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}"),
      bucket_(bucket.as_string()),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_projection_(false),
      _have_user_project_(false) {
}

// Standard destructor.
BucketsResource_GetMethod::~BucketsResource_GetMethod() {
}

util::Status BucketsResource_GetMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketsResource_GetMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketsResource_GetIamPolicyMethod::BucketsResource_GetIamPolicyMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/iam"),
      bucket_(bucket.as_string()),
      _have_user_project_(false) {
}

// Standard destructor.
BucketsResource_GetIamPolicyMethod::~BucketsResource_GetIamPolicyMethod() {
}

util::Status BucketsResource_GetIamPolicyMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketsResource_GetIamPolicyMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketsResource_InsertMethod::BucketsResource_InsertMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& project, const Bucket& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "b"),
      project_(project.as_string()),
      _have_predefined_acl_(false),
      _have_predefined_default_object_acl_(false),
      _have_projection_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
BucketsResource_InsertMethod::~BucketsResource_InsertMethod() {
}

util::Status BucketsResource_InsertMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
    StrAppend(target, sep, "project=",
              client::CppValueToEscapedUrlValue(
                project_));
    sep = "&";
  if (_have_predefined_acl_) {
    StrAppend(target, sep, "predefinedAcl=",
              client::CppValueToEscapedUrlValue(
                predefined_acl_));
    sep = "&";
  }
  if (_have_predefined_default_object_acl_) {
    StrAppend(target, sep, "predefinedDefaultObjectAcl=",
              client::CppValueToEscapedUrlValue(
                predefined_default_object_acl_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketsResource_InsertMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketsResource_ListMethod::BucketsResource_ListMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& project)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b"),
      project_(project.as_string()),
      max_results_(1000),
      _have_max_results_(false),
      _have_page_token_(false),
      _have_prefix_(false),
      _have_projection_(false),
      _have_user_project_(false) {
}

// Standard destructor.
BucketsResource_ListMethod::~BucketsResource_ListMethod() {
}

util::Status BucketsResource_ListMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
    StrAppend(target, sep, "project=",
              client::CppValueToEscapedUrlValue(
                project_));
    sep = "&";
  if (_have_max_results_) {
    StrAppend(target, sep, "maxResults=",
              client::CppValueToEscapedUrlValue(
                max_results_));
    sep = "&";
  }
  if (_have_page_token_) {
    StrAppend(target, sep, "pageToken=",
              client::CppValueToEscapedUrlValue(
                page_token_));
    sep = "&";
  }
  if (_have_prefix_) {
    StrAppend(target, sep, "prefix=",
              client::CppValueToEscapedUrlValue(
                prefix_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketsResource_ListMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketsResource_PatchMethod::BucketsResource_PatchMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Bucket& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PATCH,
        "b/{bucket}"),
      bucket_(bucket.as_string()),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_predefined_acl_(false),
      _have_predefined_default_object_acl_(false),
      _have_projection_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
BucketsResource_PatchMethod::~BucketsResource_PatchMethod() {
}

util::Status BucketsResource_PatchMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_predefined_acl_) {
    StrAppend(target, sep, "predefinedAcl=",
              client::CppValueToEscapedUrlValue(
                predefined_acl_));
    sep = "&";
  }
  if (_have_predefined_default_object_acl_) {
    StrAppend(target, sep, "predefinedDefaultObjectAcl=",
              client::CppValueToEscapedUrlValue(
                predefined_default_object_acl_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketsResource_PatchMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketsResource_SetIamPolicyMethod::BucketsResource_SetIamPolicyMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Policy& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PUT,
        "b/{bucket}/iam"),
      bucket_(bucket.as_string()),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
BucketsResource_SetIamPolicyMethod::~BucketsResource_SetIamPolicyMethod() {
}

util::Status BucketsResource_SetIamPolicyMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketsResource_SetIamPolicyMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketsResource_TestIamPermissionsMethod::BucketsResource_TestIamPermissionsMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const client::JsonCppArray<string >& permissions)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/iam/testPermissions"),
      bucket_(bucket.as_string()),
      permissions_(permissions),
      _have_user_project_(false) {
}

// Standard destructor.
BucketsResource_TestIamPermissionsMethod::~BucketsResource_TestIamPermissionsMethod() {
}

util::Status BucketsResource_TestIamPermissionsMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
    if (!permissions_.empty()) {
      target->append(sep);
      client::AppendIteratorToUrl(
        permissions_.begin(), permissions_.end(),
        "permissions", target);
      sep = "&";
    }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketsResource_TestIamPermissionsMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
BucketsResource_UpdateMethod::BucketsResource_UpdateMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Bucket& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PUT,
        "b/{bucket}"),
      bucket_(bucket.as_string()),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_predefined_acl_(false),
      _have_predefined_default_object_acl_(false),
      _have_projection_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
BucketsResource_UpdateMethod::~BucketsResource_UpdateMethod() {
}

util::Status BucketsResource_UpdateMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_predefined_acl_) {
    StrAppend(target, sep, "predefinedAcl=",
              client::CppValueToEscapedUrlValue(
                predefined_acl_));
    sep = "&";
  }
  if (_have_predefined_default_object_acl_) {
    StrAppend(target, sep, "predefinedDefaultObjectAcl=",
              client::CppValueToEscapedUrlValue(
                predefined_default_object_acl_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status BucketsResource_UpdateMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ChannelsResource_StopMethod::ChannelsResource_StopMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const Channel& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "channels/stop") {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ChannelsResource_StopMethod::~ChannelsResource_StopMethod() {
}


// Standard constructor.
DefaultObjectAccessControlsResource_DeleteMethod::DefaultObjectAccessControlsResource_DeleteMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::DELETE,
        "b/{bucket}/defaultObjectAcl/{entity}"),
      bucket_(bucket.as_string()),
      entity_(entity.as_string()),
      _have_user_project_(false) {
}

// Standard destructor.
DefaultObjectAccessControlsResource_DeleteMethod::~DefaultObjectAccessControlsResource_DeleteMethod() {
}

util::Status DefaultObjectAccessControlsResource_DeleteMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status DefaultObjectAccessControlsResource_DeleteMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
DefaultObjectAccessControlsResource_GetMethod::DefaultObjectAccessControlsResource_GetMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/defaultObjectAcl/{entity}"),
      bucket_(bucket.as_string()),
      entity_(entity.as_string()),
      _have_user_project_(false) {
}

// Standard destructor.
DefaultObjectAccessControlsResource_GetMethod::~DefaultObjectAccessControlsResource_GetMethod() {
}

util::Status DefaultObjectAccessControlsResource_GetMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status DefaultObjectAccessControlsResource_GetMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
DefaultObjectAccessControlsResource_InsertMethod::DefaultObjectAccessControlsResource_InsertMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const ObjectAccessControl& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "b/{bucket}/defaultObjectAcl"),
      bucket_(bucket.as_string()),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
DefaultObjectAccessControlsResource_InsertMethod::~DefaultObjectAccessControlsResource_InsertMethod() {
}

util::Status DefaultObjectAccessControlsResource_InsertMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status DefaultObjectAccessControlsResource_InsertMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
DefaultObjectAccessControlsResource_ListMethod::DefaultObjectAccessControlsResource_ListMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/defaultObjectAcl"),
      bucket_(bucket.as_string()),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_user_project_(false) {
}

// Standard destructor.
DefaultObjectAccessControlsResource_ListMethod::~DefaultObjectAccessControlsResource_ListMethod() {
}

util::Status DefaultObjectAccessControlsResource_ListMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status DefaultObjectAccessControlsResource_ListMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
DefaultObjectAccessControlsResource_PatchMethod::DefaultObjectAccessControlsResource_PatchMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity, const ObjectAccessControl& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PATCH,
        "b/{bucket}/defaultObjectAcl/{entity}"),
      bucket_(bucket.as_string()),
      entity_(entity.as_string()),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
DefaultObjectAccessControlsResource_PatchMethod::~DefaultObjectAccessControlsResource_PatchMethod() {
}

util::Status DefaultObjectAccessControlsResource_PatchMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status DefaultObjectAccessControlsResource_PatchMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
DefaultObjectAccessControlsResource_UpdateMethod::DefaultObjectAccessControlsResource_UpdateMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity, const ObjectAccessControl& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PUT,
        "b/{bucket}/defaultObjectAcl/{entity}"),
      bucket_(bucket.as_string()),
      entity_(entity.as_string()),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
DefaultObjectAccessControlsResource_UpdateMethod::~DefaultObjectAccessControlsResource_UpdateMethod() {
}

util::Status DefaultObjectAccessControlsResource_UpdateMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status DefaultObjectAccessControlsResource_UpdateMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
NotificationsResource_DeleteMethod::NotificationsResource_DeleteMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& notification)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::DELETE,
        "b/{bucket}/notificationConfigs/{notification}"),
      bucket_(bucket.as_string()),
      notification_(notification.as_string()),
      _have_user_project_(false) {
}

// Standard destructor.
NotificationsResource_DeleteMethod::~NotificationsResource_DeleteMethod() {
}

util::Status NotificationsResource_DeleteMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status NotificationsResource_DeleteMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "notification") {
    client::UriTemplate::AppendValue(
        notification_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
NotificationsResource_GetMethod::NotificationsResource_GetMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& notification)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/notificationConfigs/{notification}"),
      bucket_(bucket.as_string()),
      notification_(notification.as_string()),
      _have_user_project_(false) {
}

// Standard destructor.
NotificationsResource_GetMethod::~NotificationsResource_GetMethod() {
}

util::Status NotificationsResource_GetMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status NotificationsResource_GetMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "notification") {
    client::UriTemplate::AppendValue(
        notification_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
NotificationsResource_InsertMethod::NotificationsResource_InsertMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Notification& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "b/{bucket}/notificationConfigs"),
      bucket_(bucket.as_string()),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
NotificationsResource_InsertMethod::~NotificationsResource_InsertMethod() {
}

util::Status NotificationsResource_InsertMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status NotificationsResource_InsertMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
NotificationsResource_ListMethod::NotificationsResource_ListMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/notificationConfigs"),
      bucket_(bucket.as_string()),
      _have_user_project_(false) {
}

// Standard destructor.
NotificationsResource_ListMethod::~NotificationsResource_ListMethod() {
}

util::Status NotificationsResource_ListMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status NotificationsResource_ListMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectAccessControlsResource_DeleteMethod::ObjectAccessControlsResource_DeleteMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const StringPiece& entity)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::DELETE,
        "b/{bucket}/o/{object}/acl/{entity}"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      entity_(entity.as_string()),
      _have_generation_(false),
      _have_user_project_(false) {
}

// Standard destructor.
ObjectAccessControlsResource_DeleteMethod::~ObjectAccessControlsResource_DeleteMethod() {
}

util::Status ObjectAccessControlsResource_DeleteMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectAccessControlsResource_DeleteMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectAccessControlsResource_GetMethod::ObjectAccessControlsResource_GetMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const StringPiece& entity)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/o/{object}/acl/{entity}"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      entity_(entity.as_string()),
      _have_generation_(false),
      _have_user_project_(false) {
}

// Standard destructor.
ObjectAccessControlsResource_GetMethod::~ObjectAccessControlsResource_GetMethod() {
}

util::Status ObjectAccessControlsResource_GetMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectAccessControlsResource_GetMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectAccessControlsResource_InsertMethod::ObjectAccessControlsResource_InsertMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const ObjectAccessControl& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "b/{bucket}/o/{object}/acl"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      _have_generation_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ObjectAccessControlsResource_InsertMethod::~ObjectAccessControlsResource_InsertMethod() {
}

util::Status ObjectAccessControlsResource_InsertMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectAccessControlsResource_InsertMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectAccessControlsResource_ListMethod::ObjectAccessControlsResource_ListMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/o/{object}/acl"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      _have_generation_(false),
      _have_user_project_(false) {
}

// Standard destructor.
ObjectAccessControlsResource_ListMethod::~ObjectAccessControlsResource_ListMethod() {
}

util::Status ObjectAccessControlsResource_ListMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectAccessControlsResource_ListMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectAccessControlsResource_PatchMethod::ObjectAccessControlsResource_PatchMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const StringPiece& entity, const ObjectAccessControl& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PATCH,
        "b/{bucket}/o/{object}/acl/{entity}"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      entity_(entity.as_string()),
      _have_generation_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ObjectAccessControlsResource_PatchMethod::~ObjectAccessControlsResource_PatchMethod() {
}

util::Status ObjectAccessControlsResource_PatchMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectAccessControlsResource_PatchMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectAccessControlsResource_UpdateMethod::ObjectAccessControlsResource_UpdateMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const StringPiece& entity, const ObjectAccessControl& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PUT,
        "b/{bucket}/o/{object}/acl/{entity}"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      entity_(entity.as_string()),
      _have_generation_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ObjectAccessControlsResource_UpdateMethod::~ObjectAccessControlsResource_UpdateMethod() {
}

util::Status ObjectAccessControlsResource_UpdateMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectAccessControlsResource_UpdateMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "entity") {
    client::UriTemplate::AppendValue(
        entity_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_ComposeMethod::ObjectsResource_ComposeMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& destination_bucket, const StringPiece& destination_object, const ComposeRequest& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "b/{destinationBucket}/o/{destinationObject}/compose"),
      destination_bucket_(destination_bucket.as_string()),
      destination_object_(destination_object.as_string()),
      _have_destination_predefined_acl_(false),
      _have_if_generation_match_(false),
      _have_if_metageneration_match_(false),
      _have_kms_key_name_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ObjectsResource_ComposeMethod::~ObjectsResource_ComposeMethod() {
}

util::Status ObjectsResource_ComposeMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_destination_predefined_acl_) {
    StrAppend(target, sep, "destinationPredefinedAcl=",
              client::CppValueToEscapedUrlValue(
                destination_predefined_acl_));
    sep = "&";
  }
  if (_have_if_generation_match_) {
    StrAppend(target, sep, "ifGenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_match_));
    sep = "&";
  }
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_kms_key_name_) {
    StrAppend(target, sep, "kmsKeyName=",
              client::CppValueToEscapedUrlValue(
                kms_key_name_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_ComposeMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "destinationBucket") {
    client::UriTemplate::AppendValue(
        destination_bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "destinationObject") {
    client::UriTemplate::AppendValue(
        destination_object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_CopyMethod::ObjectsResource_CopyMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& source_bucket, const StringPiece& source_object, const StringPiece& destination_bucket, const StringPiece& destination_object, const Object& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}"),
      source_bucket_(source_bucket.as_string()),
      source_object_(source_object.as_string()),
      destination_bucket_(destination_bucket.as_string()),
      destination_object_(destination_object.as_string()),
      _have_destination_predefined_acl_(false),
      _have_if_generation_match_(false),
      _have_if_generation_not_match_(false),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_if_source_generation_match_(false),
      _have_if_source_generation_not_match_(false),
      _have_if_source_metageneration_match_(false),
      _have_if_source_metageneration_not_match_(false),
      _have_projection_(false),
      _have_source_generation_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ObjectsResource_CopyMethod::~ObjectsResource_CopyMethod() {
}

util::Status ObjectsResource_CopyMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_destination_predefined_acl_) {
    StrAppend(target, sep, "destinationPredefinedAcl=",
              client::CppValueToEscapedUrlValue(
                destination_predefined_acl_));
    sep = "&";
  }
  if (_have_if_generation_match_) {
    StrAppend(target, sep, "ifGenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_match_));
    sep = "&";
  }
  if (_have_if_generation_not_match_) {
    StrAppend(target, sep, "ifGenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_not_match_));
    sep = "&";
  }
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_if_source_generation_match_) {
    StrAppend(target, sep, "ifSourceGenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_source_generation_match_));
    sep = "&";
  }
  if (_have_if_source_generation_not_match_) {
    StrAppend(target, sep, "ifSourceGenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_source_generation_not_match_));
    sep = "&";
  }
  if (_have_if_source_metageneration_match_) {
    StrAppend(target, sep, "ifSourceMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_source_metageneration_match_));
    sep = "&";
  }
  if (_have_if_source_metageneration_not_match_) {
    StrAppend(target, sep, "ifSourceMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_source_metageneration_not_match_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_source_generation_) {
    StrAppend(target, sep, "sourceGeneration=",
              client::CppValueToEscapedUrlValue(
                source_generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_CopyMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "sourceBucket") {
    client::UriTemplate::AppendValue(
        source_bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "sourceObject") {
    client::UriTemplate::AppendValue(
        source_object_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "destinationBucket") {
    client::UriTemplate::AppendValue(
        destination_bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "destinationObject") {
    client::UriTemplate::AppendValue(
        destination_object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_DeleteMethod::ObjectsResource_DeleteMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::DELETE,
        "b/{bucket}/o/{object}"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      _have_generation_(false),
      _have_if_generation_match_(false),
      _have_if_generation_not_match_(false),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_user_project_(false) {
}

// Standard destructor.
ObjectsResource_DeleteMethod::~ObjectsResource_DeleteMethod() {
}

util::Status ObjectsResource_DeleteMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_if_generation_match_) {
    StrAppend(target, sep, "ifGenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_match_));
    sep = "&";
  }
  if (_have_if_generation_not_match_) {
    StrAppend(target, sep, "ifGenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_not_match_));
    sep = "&";
  }
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_DeleteMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_GetMethod::ObjectsResource_GetMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/o/{object}"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      _have_generation_(false),
      _have_if_generation_match_(false),
      _have_if_generation_not_match_(false),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_projection_(false),
      _have_user_project_(false) {
}

// Standard destructor.
ObjectsResource_GetMethod::~ObjectsResource_GetMethod() {
}

util::Status ObjectsResource_GetMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_if_generation_match_) {
    StrAppend(target, sep, "ifGenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_match_));
    sep = "&";
  }
  if (_have_if_generation_not_match_) {
    StrAppend(target, sep, "ifGenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_not_match_));
    sep = "&";
  }
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_GetMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_GetIamPolicyMethod::ObjectsResource_GetIamPolicyMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/o/{object}/iam"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      _have_generation_(false),
      _have_user_project_(false) {
}

// Standard destructor.
ObjectsResource_GetIamPolicyMethod::~ObjectsResource_GetIamPolicyMethod() {
}

util::Status ObjectsResource_GetIamPolicyMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_GetIamPolicyMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// static
const client::MediaUploadSpec
ObjectsResource_InsertMethod::SIMPLE_MEDIA_UPLOAD(
    "simple", "/upload/storage/v1/b/{bucket}/o", true);


// static
const client::MediaUploadSpec
ObjectsResource_InsertMethod::RESUMABLE_MEDIA_UPLOAD(
    "resumable", "/resumable/upload/storage/v1/b/{bucket}/o", true);



// Deprecated constructor did not take media upload arguments.
ObjectsResource_InsertMethod::ObjectsResource_InsertMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket)
    : StorageServiceBaseRequest(
      _service_, _credential_,
      client::HttpRequest::POST,
      "b/{bucket}/o"),
      bucket_(bucket.as_string()),
      _have_content_encoding_(false),
      _have_if_generation_match_(false),
      _have_if_generation_not_match_(false),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_kms_key_name_(false),
      _have_name_(false),
      _have_predefined_acl_(false),
      _have_projection_(false),
      _have_user_project_(false) {
  uploader_.reset(new client::MediaUploader(
      &SIMPLE_MEDIA_UPLOAD,
      _service_->url_root(),
      client::JoinPath(
          _service_->url_path(), "b/{bucket}/o")));
}
// Standard constructor.
ObjectsResource_InsertMethod::ObjectsResource_InsertMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Object* _metadata_, const char* _media_content_type_, client::DataReader* _media_content_reader_)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "b/{bucket}/o"),
      bucket_(bucket.as_string()),
      _have_content_encoding_(false),
      _have_if_generation_match_(false),
      _have_if_generation_not_match_(false),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_kms_key_name_(false),
      _have_name_(false),
      _have_predefined_acl_(false),
      _have_projection_(false),
      _have_user_project_(false) {
  if (_media_content_reader_) {
    client::MediaUploader* uploader =
        new client::MediaUploader(
            &SIMPLE_MEDIA_UPLOAD,
            _service_->url_root(),
            client::JoinPath(
                _service_->url_path(), "b/{bucket}/o"));
    if (_metadata_) {
      uploader->set_metadata(*_metadata_);
    }
    uploader->set_media_content_reader(
        _media_content_type_, _media_content_reader_);
    ResetMediaUploader(uploader);
  } else {
    AddJsonContentToRequest(_metadata_);
  }
}

// Standard destructor.
ObjectsResource_InsertMethod::~ObjectsResource_InsertMethod() {
}

util::Status ObjectsResource_InsertMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_content_encoding_) {
    StrAppend(target, sep, "contentEncoding=",
              client::CppValueToEscapedUrlValue(
                content_encoding_));
    sep = "&";
  }
  if (_have_if_generation_match_) {
    StrAppend(target, sep, "ifGenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_match_));
    sep = "&";
  }
  if (_have_if_generation_not_match_) {
    StrAppend(target, sep, "ifGenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_not_match_));
    sep = "&";
  }
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_kms_key_name_) {
    StrAppend(target, sep, "kmsKeyName=",
              client::CppValueToEscapedUrlValue(
                kms_key_name_));
    sep = "&";
  }
  if (_have_name_) {
    StrAppend(target, sep, "name=",
              client::CppValueToEscapedUrlValue(
                name_));
    sep = "&";
  }
  if (_have_predefined_acl_) {
    StrAppend(target, sep, "predefinedAcl=",
              client::CppValueToEscapedUrlValue(
                predefined_acl_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_InsertMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_ListMethod::ObjectsResource_ListMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/o"),
      bucket_(bucket.as_string()),
      max_results_(1000),
      _have_delimiter_(false),
      _have_max_results_(false),
      _have_page_token_(false),
      _have_prefix_(false),
      _have_projection_(false),
      _have_user_project_(false),
      _have_versions_(false) {
}

// Standard destructor.
ObjectsResource_ListMethod::~ObjectsResource_ListMethod() {
}

util::Status ObjectsResource_ListMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_delimiter_) {
    StrAppend(target, sep, "delimiter=",
              client::CppValueToEscapedUrlValue(
                delimiter_));
    sep = "&";
  }
  if (_have_max_results_) {
    StrAppend(target, sep, "maxResults=",
              client::CppValueToEscapedUrlValue(
                max_results_));
    sep = "&";
  }
  if (_have_page_token_) {
    StrAppend(target, sep, "pageToken=",
              client::CppValueToEscapedUrlValue(
                page_token_));
    sep = "&";
  }
  if (_have_prefix_) {
    StrAppend(target, sep, "prefix=",
              client::CppValueToEscapedUrlValue(
                prefix_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  if (_have_versions_) {
    StrAppend(target, sep, "versions=",
              client::CppValueToEscapedUrlValue(
                versions_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_ListMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_PatchMethod::ObjectsResource_PatchMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const Object& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PATCH,
        "b/{bucket}/o/{object}"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      _have_generation_(false),
      _have_if_generation_match_(false),
      _have_if_generation_not_match_(false),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_predefined_acl_(false),
      _have_projection_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ObjectsResource_PatchMethod::~ObjectsResource_PatchMethod() {
}

util::Status ObjectsResource_PatchMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_if_generation_match_) {
    StrAppend(target, sep, "ifGenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_match_));
    sep = "&";
  }
  if (_have_if_generation_not_match_) {
    StrAppend(target, sep, "ifGenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_not_match_));
    sep = "&";
  }
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_predefined_acl_) {
    StrAppend(target, sep, "predefinedAcl=",
              client::CppValueToEscapedUrlValue(
                predefined_acl_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_PatchMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_RewriteMethod::ObjectsResource_RewriteMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& source_bucket, const StringPiece& source_object, const StringPiece& destination_bucket, const StringPiece& destination_object, const Object& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}"),
      source_bucket_(source_bucket.as_string()),
      source_object_(source_object.as_string()),
      destination_bucket_(destination_bucket.as_string()),
      destination_object_(destination_object.as_string()),
      _have_destination_kms_key_name_(false),
      _have_destination_predefined_acl_(false),
      _have_if_generation_match_(false),
      _have_if_generation_not_match_(false),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_if_source_generation_match_(false),
      _have_if_source_generation_not_match_(false),
      _have_if_source_metageneration_match_(false),
      _have_if_source_metageneration_not_match_(false),
      _have_max_bytes_rewritten_per_call_(false),
      _have_projection_(false),
      _have_rewrite_token_(false),
      _have_source_generation_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ObjectsResource_RewriteMethod::~ObjectsResource_RewriteMethod() {
}

util::Status ObjectsResource_RewriteMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_destination_kms_key_name_) {
    StrAppend(target, sep, "destinationKmsKeyName=",
              client::CppValueToEscapedUrlValue(
                destination_kms_key_name_));
    sep = "&";
  }
  if (_have_destination_predefined_acl_) {
    StrAppend(target, sep, "destinationPredefinedAcl=",
              client::CppValueToEscapedUrlValue(
                destination_predefined_acl_));
    sep = "&";
  }
  if (_have_if_generation_match_) {
    StrAppend(target, sep, "ifGenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_match_));
    sep = "&";
  }
  if (_have_if_generation_not_match_) {
    StrAppend(target, sep, "ifGenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_not_match_));
    sep = "&";
  }
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_if_source_generation_match_) {
    StrAppend(target, sep, "ifSourceGenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_source_generation_match_));
    sep = "&";
  }
  if (_have_if_source_generation_not_match_) {
    StrAppend(target, sep, "ifSourceGenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_source_generation_not_match_));
    sep = "&";
  }
  if (_have_if_source_metageneration_match_) {
    StrAppend(target, sep, "ifSourceMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_source_metageneration_match_));
    sep = "&";
  }
  if (_have_if_source_metageneration_not_match_) {
    StrAppend(target, sep, "ifSourceMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_source_metageneration_not_match_));
    sep = "&";
  }
  if (_have_max_bytes_rewritten_per_call_) {
    StrAppend(target, sep, "maxBytesRewrittenPerCall=",
              client::CppValueToEscapedUrlValue(
                max_bytes_rewritten_per_call_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_rewrite_token_) {
    StrAppend(target, sep, "rewriteToken=",
              client::CppValueToEscapedUrlValue(
                rewrite_token_));
    sep = "&";
  }
  if (_have_source_generation_) {
    StrAppend(target, sep, "sourceGeneration=",
              client::CppValueToEscapedUrlValue(
                source_generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_RewriteMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "sourceBucket") {
    client::UriTemplate::AppendValue(
        source_bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "sourceObject") {
    client::UriTemplate::AppendValue(
        source_object_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "destinationBucket") {
    client::UriTemplate::AppendValue(
        destination_bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "destinationObject") {
    client::UriTemplate::AppendValue(
        destination_object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_SetIamPolicyMethod::ObjectsResource_SetIamPolicyMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const Policy& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PUT,
        "b/{bucket}/o/{object}/iam"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      _have_generation_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ObjectsResource_SetIamPolicyMethod::~ObjectsResource_SetIamPolicyMethod() {
}

util::Status ObjectsResource_SetIamPolicyMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_SetIamPolicyMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_TestIamPermissionsMethod::ObjectsResource_TestIamPermissionsMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const client::JsonCppArray<string >& permissions)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "b/{bucket}/o/{object}/iam/testPermissions"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      permissions_(permissions),
      _have_generation_(false),
      _have_user_project_(false) {
}

// Standard destructor.
ObjectsResource_TestIamPermissionsMethod::~ObjectsResource_TestIamPermissionsMethod() {
}

util::Status ObjectsResource_TestIamPermissionsMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
    if (!permissions_.empty()) {
      target->append(sep);
      client::AppendIteratorToUrl(
        permissions_.begin(), permissions_.end(),
        "permissions", target);
      sep = "&";
    }
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_TestIamPermissionsMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_UpdateMethod::ObjectsResource_UpdateMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const Object& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::PUT,
        "b/{bucket}/o/{object}"),
      bucket_(bucket.as_string()),
      object_(object.as_string()),
      _have_generation_(false),
      _have_if_generation_match_(false),
      _have_if_generation_not_match_(false),
      _have_if_metageneration_match_(false),
      _have_if_metageneration_not_match_(false),
      _have_predefined_acl_(false),
      _have_projection_(false),
      _have_user_project_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ObjectsResource_UpdateMethod::~ObjectsResource_UpdateMethod() {
}

util::Status ObjectsResource_UpdateMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_generation_) {
    StrAppend(target, sep, "generation=",
              client::CppValueToEscapedUrlValue(
                generation_));
    sep = "&";
  }
  if (_have_if_generation_match_) {
    StrAppend(target, sep, "ifGenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_match_));
    sep = "&";
  }
  if (_have_if_generation_not_match_) {
    StrAppend(target, sep, "ifGenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_generation_not_match_));
    sep = "&";
  }
  if (_have_if_metageneration_match_) {
    StrAppend(target, sep, "ifMetagenerationMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_match_));
    sep = "&";
  }
  if (_have_if_metageneration_not_match_) {
    StrAppend(target, sep, "ifMetagenerationNotMatch=",
              client::CppValueToEscapedUrlValue(
                if_metageneration_not_match_));
    sep = "&";
  }
  if (_have_predefined_acl_) {
    StrAppend(target, sep, "predefinedAcl=",
              client::CppValueToEscapedUrlValue(
                predefined_acl_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_UpdateMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  if (variable_name == "object") {
    client::UriTemplate::AppendValue(
        object_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}


// Standard constructor.
ObjectsResource_WatchAllMethod::ObjectsResource_WatchAllMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Channel& __request_content__)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::POST,
        "b/{bucket}/o/watch"),
      bucket_(bucket.as_string()),
      max_results_(1000),
      _have_delimiter_(false),
      _have_max_results_(false),
      _have_page_token_(false),
      _have_prefix_(false),
      _have_projection_(false),
      _have_user_project_(false),
      _have_versions_(false) {
  AddJsonContentToRequest(&__request_content__);
}

// Standard destructor.
ObjectsResource_WatchAllMethod::~ObjectsResource_WatchAllMethod() {
}

util::Status ObjectsResource_WatchAllMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_delimiter_) {
    StrAppend(target, sep, "delimiter=",
              client::CppValueToEscapedUrlValue(
                delimiter_));
    sep = "&";
  }
  if (_have_max_results_) {
    StrAppend(target, sep, "maxResults=",
              client::CppValueToEscapedUrlValue(
                max_results_));
    sep = "&";
  }
  if (_have_page_token_) {
    StrAppend(target, sep, "pageToken=",
              client::CppValueToEscapedUrlValue(
                page_token_));
    sep = "&";
  }
  if (_have_prefix_) {
    StrAppend(target, sep, "prefix=",
              client::CppValueToEscapedUrlValue(
                prefix_));
    sep = "&";
  }
  if (_have_projection_) {
    StrAppend(target, sep, "projection=",
              client::CppValueToEscapedUrlValue(
                projection_));
    sep = "&";
  }
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  if (_have_versions_) {
    StrAppend(target, sep, "versions=",
              client::CppValueToEscapedUrlValue(
                versions_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ObjectsResource_WatchAllMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "bucket") {
    client::UriTemplate::AppendValue(
        bucket_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}





// Standard constructor.
ProjectsResource_ServiceAccountResource_GetMethod::ProjectsResource_ServiceAccountResource_GetMethod(
    const StorageService* _service_, client::AuthorizationCredential* _credential_, const StringPiece& project_id)
    : StorageServiceBaseRequest(
        _service_, _credential_,
        client::HttpRequest::GET,
        "projects/{projectId}/serviceAccount"),
      project_id_(project_id.as_string()),
      _have_user_project_(false) {
}

// Standard destructor.
ProjectsResource_ServiceAccountResource_GetMethod::~ProjectsResource_ServiceAccountResource_GetMethod() {
}

util::Status ProjectsResource_ServiceAccountResource_GetMethod::AppendOptionalQueryParameters(string* target) {
  const char* sep = (target->find('?') == string::npos) ? "?" : "&";
  if (_have_user_project_) {
    StrAppend(target, sep, "userProject=",
              client::CppValueToEscapedUrlValue(
                user_project_));
    sep = "&";
  }
  return StorageServiceBaseRequest::AppendOptionalQueryParameters(target);
}
util::Status ProjectsResource_ServiceAccountResource_GetMethod::AppendVariable(
        const string& variable_name,
        const client::UriTemplateConfig& config,
        string* target) {
  if (variable_name == "projectId") {
    client::UriTemplate::AppendValue(
        project_id_, config, target);
    return client::StatusOk();
  }
  return StorageServiceBaseRequest::AppendVariable(
      variable_name, config, target);
}



StorageService::StorageService(client::HttpTransport* transport)
  : ClientService("https://www.googleapis.com/", "storage/v1/", transport), bucket_access_controls_(this), buckets_(this), channels_(this), default_object_access_controls_(this), notifications_(this), object_access_controls_(this), objects_(this), projects_(this) {
  this->SetBatchPath("batch");
}

StorageService::~StorageService() {
}


StorageService::BucketAccessControlsResource::BucketAccessControlsResource(StorageService* service)
  : service_(service) {
}



BucketAccessControlsResource_DeleteMethod* StorageService::BucketAccessControlsResource::NewDeleteMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity) const {
  return new BucketAccessControlsResource_DeleteMethod(service_, _credential_, bucket, entity);
}


BucketAccessControlsResource_GetMethod* StorageService::BucketAccessControlsResource::NewGetMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity) const {
  return new BucketAccessControlsResource_GetMethod(service_, _credential_, bucket, entity);
}


BucketAccessControlsResource_InsertMethod* StorageService::BucketAccessControlsResource::NewInsertMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const BucketAccessControl& __request_content__) const {
  return new BucketAccessControlsResource_InsertMethod(service_, _credential_, bucket, __request_content__);
}


BucketAccessControlsResource_ListMethod* StorageService::BucketAccessControlsResource::NewListMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket) const {
  return new BucketAccessControlsResource_ListMethod(service_, _credential_, bucket);
}


BucketAccessControlsResource_PatchMethod* StorageService::BucketAccessControlsResource::NewPatchMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity, const BucketAccessControl& __request_content__) const {
  return new BucketAccessControlsResource_PatchMethod(service_, _credential_, bucket, entity, __request_content__);
}


BucketAccessControlsResource_UpdateMethod* StorageService::BucketAccessControlsResource::NewUpdateMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity, const BucketAccessControl& __request_content__) const {
  return new BucketAccessControlsResource_UpdateMethod(service_, _credential_, bucket, entity, __request_content__);
}

StorageService::BucketsResource::BucketsResource(StorageService* service)
  : service_(service) {
}



BucketsResource_DeleteMethod* StorageService::BucketsResource::NewDeleteMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket) const {
  return new BucketsResource_DeleteMethod(service_, _credential_, bucket);
}


BucketsResource_GetMethod* StorageService::BucketsResource::NewGetMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket) const {
  return new BucketsResource_GetMethod(service_, _credential_, bucket);
}


BucketsResource_GetIamPolicyMethod* StorageService::BucketsResource::NewGetIamPolicyMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket) const {
  return new BucketsResource_GetIamPolicyMethod(service_, _credential_, bucket);
}


BucketsResource_InsertMethod* StorageService::BucketsResource::NewInsertMethod(client::AuthorizationCredential* _credential_, const StringPiece& project, const Bucket& __request_content__) const {
  return new BucketsResource_InsertMethod(service_, _credential_, project, __request_content__);
}


BucketsResource_ListMethod* StorageService::BucketsResource::NewListMethod(client::AuthorizationCredential* _credential_, const StringPiece& project) const {
  return new BucketsResource_ListMethod(service_, _credential_, project);
}


BucketsResource_ListMethodPager* StorageService::BucketsResource::NewListMethodPager(client::AuthorizationCredential* _credential_, const StringPiece& project) const {
  return new client::EncapsulatedServiceRequestPager<BucketsResource_ListMethod, Buckets>(new BucketsResource_ListMethod(service_, _credential_, project));
}


BucketsResource_PatchMethod* StorageService::BucketsResource::NewPatchMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Bucket& __request_content__) const {
  return new BucketsResource_PatchMethod(service_, _credential_, bucket, __request_content__);
}


BucketsResource_SetIamPolicyMethod* StorageService::BucketsResource::NewSetIamPolicyMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Policy& __request_content__) const {
  return new BucketsResource_SetIamPolicyMethod(service_, _credential_, bucket, __request_content__);
}


BucketsResource_TestIamPermissionsMethod* StorageService::BucketsResource::NewTestIamPermissionsMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const client::JsonCppArray<string >& permissions) const {
  return new BucketsResource_TestIamPermissionsMethod(service_, _credential_, bucket, permissions);
}


BucketsResource_UpdateMethod* StorageService::BucketsResource::NewUpdateMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Bucket& __request_content__) const {
  return new BucketsResource_UpdateMethod(service_, _credential_, bucket, __request_content__);
}

StorageService::ChannelsResource::ChannelsResource(StorageService* service)
  : service_(service) {
}



ChannelsResource_StopMethod* StorageService::ChannelsResource::NewStopMethod(client::AuthorizationCredential* _credential_, const Channel& __request_content__) const {
  return new ChannelsResource_StopMethod(service_, _credential_, __request_content__);
}

StorageService::DefaultObjectAccessControlsResource::DefaultObjectAccessControlsResource(StorageService* service)
  : service_(service) {
}



DefaultObjectAccessControlsResource_DeleteMethod* StorageService::DefaultObjectAccessControlsResource::NewDeleteMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity) const {
  return new DefaultObjectAccessControlsResource_DeleteMethod(service_, _credential_, bucket, entity);
}


DefaultObjectAccessControlsResource_GetMethod* StorageService::DefaultObjectAccessControlsResource::NewGetMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity) const {
  return new DefaultObjectAccessControlsResource_GetMethod(service_, _credential_, bucket, entity);
}


DefaultObjectAccessControlsResource_InsertMethod* StorageService::DefaultObjectAccessControlsResource::NewInsertMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const ObjectAccessControl& __request_content__) const {
  return new DefaultObjectAccessControlsResource_InsertMethod(service_, _credential_, bucket, __request_content__);
}


DefaultObjectAccessControlsResource_ListMethod* StorageService::DefaultObjectAccessControlsResource::NewListMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket) const {
  return new DefaultObjectAccessControlsResource_ListMethod(service_, _credential_, bucket);
}


DefaultObjectAccessControlsResource_PatchMethod* StorageService::DefaultObjectAccessControlsResource::NewPatchMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity, const ObjectAccessControl& __request_content__) const {
  return new DefaultObjectAccessControlsResource_PatchMethod(service_, _credential_, bucket, entity, __request_content__);
}


DefaultObjectAccessControlsResource_UpdateMethod* StorageService::DefaultObjectAccessControlsResource::NewUpdateMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& entity, const ObjectAccessControl& __request_content__) const {
  return new DefaultObjectAccessControlsResource_UpdateMethod(service_, _credential_, bucket, entity, __request_content__);
}

StorageService::NotificationsResource::NotificationsResource(StorageService* service)
  : service_(service) {
}



NotificationsResource_DeleteMethod* StorageService::NotificationsResource::NewDeleteMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& notification) const {
  return new NotificationsResource_DeleteMethod(service_, _credential_, bucket, notification);
}


NotificationsResource_GetMethod* StorageService::NotificationsResource::NewGetMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& notification) const {
  return new NotificationsResource_GetMethod(service_, _credential_, bucket, notification);
}


NotificationsResource_InsertMethod* StorageService::NotificationsResource::NewInsertMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Notification& __request_content__) const {
  return new NotificationsResource_InsertMethod(service_, _credential_, bucket, __request_content__);
}


NotificationsResource_ListMethod* StorageService::NotificationsResource::NewListMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket) const {
  return new NotificationsResource_ListMethod(service_, _credential_, bucket);
}

StorageService::ObjectAccessControlsResource::ObjectAccessControlsResource(StorageService* service)
  : service_(service) {
}



ObjectAccessControlsResource_DeleteMethod* StorageService::ObjectAccessControlsResource::NewDeleteMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const StringPiece& entity) const {
  return new ObjectAccessControlsResource_DeleteMethod(service_, _credential_, bucket, object, entity);
}


ObjectAccessControlsResource_GetMethod* StorageService::ObjectAccessControlsResource::NewGetMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const StringPiece& entity) const {
  return new ObjectAccessControlsResource_GetMethod(service_, _credential_, bucket, object, entity);
}


ObjectAccessControlsResource_InsertMethod* StorageService::ObjectAccessControlsResource::NewInsertMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const ObjectAccessControl& __request_content__) const {
  return new ObjectAccessControlsResource_InsertMethod(service_, _credential_, bucket, object, __request_content__);
}


ObjectAccessControlsResource_ListMethod* StorageService::ObjectAccessControlsResource::NewListMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object) const {
  return new ObjectAccessControlsResource_ListMethod(service_, _credential_, bucket, object);
}


ObjectAccessControlsResource_PatchMethod* StorageService::ObjectAccessControlsResource::NewPatchMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const StringPiece& entity, const ObjectAccessControl& __request_content__) const {
  return new ObjectAccessControlsResource_PatchMethod(service_, _credential_, bucket, object, entity, __request_content__);
}


ObjectAccessControlsResource_UpdateMethod* StorageService::ObjectAccessControlsResource::NewUpdateMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const StringPiece& entity, const ObjectAccessControl& __request_content__) const {
  return new ObjectAccessControlsResource_UpdateMethod(service_, _credential_, bucket, object, entity, __request_content__);
}

StorageService::ObjectsResource::ObjectsResource(StorageService* service)
  : service_(service) {
}



ObjectsResource_ComposeMethod* StorageService::ObjectsResource::NewComposeMethod(client::AuthorizationCredential* _credential_, const StringPiece& destination_bucket, const StringPiece& destination_object, const ComposeRequest& __request_content__) const {
  return new ObjectsResource_ComposeMethod(service_, _credential_, destination_bucket, destination_object, __request_content__);
}


ObjectsResource_CopyMethod* StorageService::ObjectsResource::NewCopyMethod(client::AuthorizationCredential* _credential_, const StringPiece& source_bucket, const StringPiece& source_object, const StringPiece& destination_bucket, const StringPiece& destination_object, const Object& __request_content__) const {
  return new ObjectsResource_CopyMethod(service_, _credential_, source_bucket, source_object, destination_bucket, destination_object, __request_content__);
}


ObjectsResource_DeleteMethod* StorageService::ObjectsResource::NewDeleteMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object) const {
  return new ObjectsResource_DeleteMethod(service_, _credential_, bucket, object);
}


ObjectsResource_GetMethod* StorageService::ObjectsResource::NewGetMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object) const {
  return new ObjectsResource_GetMethod(service_, _credential_, bucket, object);
}


ObjectsResource_GetIamPolicyMethod* StorageService::ObjectsResource::NewGetIamPolicyMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object) const {
  return new ObjectsResource_GetIamPolicyMethod(service_, _credential_, bucket, object);
}



// This factory method is deprecated in favor of the newer variation that
// also takes the media upload parameters.
ObjectsResource_InsertMethod* StorageService::ObjectsResource::NewInsertMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket) const {
  return new ObjectsResource_InsertMethod(service_, _credential_, bucket);
}

ObjectsResource_InsertMethod* StorageService::ObjectsResource::NewInsertMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Object* _metadata_, const char* _media_content_type_, client::DataReader* _media_content_reader_) const {
  return new ObjectsResource_InsertMethod(service_, _credential_, bucket, _metadata_, _media_content_type_, _media_content_reader_);
}


ObjectsResource_ListMethod* StorageService::ObjectsResource::NewListMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket) const {
  return new ObjectsResource_ListMethod(service_, _credential_, bucket);
}


ObjectsResource_ListMethodPager* StorageService::ObjectsResource::NewListMethodPager(client::AuthorizationCredential* _credential_, const StringPiece& bucket) const {
  return new client::EncapsulatedServiceRequestPager<ObjectsResource_ListMethod, Objects>(new ObjectsResource_ListMethod(service_, _credential_, bucket));
}


ObjectsResource_PatchMethod* StorageService::ObjectsResource::NewPatchMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const Object& __request_content__) const {
  return new ObjectsResource_PatchMethod(service_, _credential_, bucket, object, __request_content__);
}


ObjectsResource_RewriteMethod* StorageService::ObjectsResource::NewRewriteMethod(client::AuthorizationCredential* _credential_, const StringPiece& source_bucket, const StringPiece& source_object, const StringPiece& destination_bucket, const StringPiece& destination_object, const Object& __request_content__) const {
  return new ObjectsResource_RewriteMethod(service_, _credential_, source_bucket, source_object, destination_bucket, destination_object, __request_content__);
}


ObjectsResource_SetIamPolicyMethod* StorageService::ObjectsResource::NewSetIamPolicyMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const Policy& __request_content__) const {
  return new ObjectsResource_SetIamPolicyMethod(service_, _credential_, bucket, object, __request_content__);
}


ObjectsResource_TestIamPermissionsMethod* StorageService::ObjectsResource::NewTestIamPermissionsMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const client::JsonCppArray<string >& permissions) const {
  return new ObjectsResource_TestIamPermissionsMethod(service_, _credential_, bucket, object, permissions);
}


ObjectsResource_UpdateMethod* StorageService::ObjectsResource::NewUpdateMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const StringPiece& object, const Object& __request_content__) const {
  return new ObjectsResource_UpdateMethod(service_, _credential_, bucket, object, __request_content__);
}


ObjectsResource_WatchAllMethod* StorageService::ObjectsResource::NewWatchAllMethod(client::AuthorizationCredential* _credential_, const StringPiece& bucket, const Channel& __request_content__) const {
  return new ObjectsResource_WatchAllMethod(service_, _credential_, bucket, __request_content__);
}

StorageService::ProjectsResource::ProjectsResource(StorageService* service)
  : service_(service), service_account_(service) {
}




StorageService::ProjectsResource::ServiceAccountResource::ServiceAccountResource(StorageService* service)
  : service_(service) {
}



ProjectsResource_ServiceAccountResource_GetMethod* StorageService::ProjectsResource::ServiceAccountResource::NewGetMethod(client::AuthorizationCredential* _credential_, const StringPiece& project_id) const {
  return new ProjectsResource_ServiceAccountResource_GetMethod(service_, _credential_, project_id);
}
}  // namespace google_storage_api
